package com.itheima.string;

public class StringMethod08 {
    public static void main(String[] args) {
        String s1 = "  good good study,day day up  ";
        //将s1所有英文单词全部转为大写字母-->toUpperCase()
        String s2 = s1.toUpperCase();
        System.out.println("s2 = " + s2);
        //将s2全部转为小写-->toLowerCase()
        String s3 = s2.toLowerCase();
        System.out.println("s3 = " + s3);
        //将s1前后空格消除-->trim()
        String s4 = s3.trim();
        System.out.println("s4 = " + s4);
        //判断s1是否包含指定的字符串内容study-->contains()
        boolean res1 = s1.contains("study");
        System.out.println("res1 = " + res1);

        //判断ss是否以...开头-->startsWith()
        String ss = "德玛西亚";
        boolean res2 = ss.startsWith("德玛");
        System.out.println("res2 = " + res2);
        //判断ss是否以...结尾-->endsWith()
        boolean res3 = ss.endsWith("西亚");
        System.out.println("res3 = " + res3);

        String str = "黑化肥挥发后会发黑";
        //获取str中"黑"字第一次出现的索引位置-->indexOf()
        int index = str.indexOf("黑");
        System.out.println("index = " + index);
    }
}
